package com.sp.scmdb.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;

import com.sp.scmdb.common.HibernateObject;

@Entity
@Table(name = "OBJ_ViolationRecord")
public class ViolationRecord extends HibernateObject {

	@Column(name = "title")
	private String title;

	@Column(name = "content")
	private String content;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "empId", insertable = true, updatable = true)
	@NotFound(action = NotFoundAction.IGNORE)
	private Employee employee;

	@Column(name = "violationDate")
	private String violationDate;

	@Column(name = "grade")
	private String grade;

	@Column(name = "illegalType")
	private String illegalType;

	@Column(name = "createdDate")
	@Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime")
	private DateTime createdDate;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "creatorId", insertable = true, updatable = false)
	@NotFound(action = NotFoundAction.IGNORE)
	private User user;

	@Column(name = "rectification")
	private boolean rectification;

	@Column(name = "description")
	private String description;

	@Column(name = "vtype")
	private String vtype;

	@Column(name = "state")
	private String state;

	@Column(name = "attachmentId", updatable = false)
	private String attachmentId;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	public String getViolationDate() {
		return violationDate;
	}

	public void setViolationDate(String violationDate) {
		this.violationDate = violationDate;
	}

	public String getGrade() {
		return grade;
	}

	public void setGrade(String grade) {
		this.grade = grade;
	}

	public String getIllegalType() {
		return illegalType;
	}

	public void setIllegalType(String illegalType) {
		this.illegalType = illegalType;
	}

	public DateTime getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(DateTime createdDate) {
		this.createdDate = createdDate;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public boolean getRectification() {
		return rectification;
	}

	public void setRectification(boolean rectification) {
		this.rectification = rectification;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getVtype() {
		return vtype;
	}

	public void setVtype(String vtype) {
		this.vtype = vtype;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getAttachmentId() {
		return attachmentId;
	}

	public void setAttachmentId(String attachmentId) {
		this.attachmentId = attachmentId;
	}
}
